﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;


namespace CDStore3Tiers
{
    public class XuLyThongKe
    {
        static StoreCDDataContext cd = new StoreCDDataContext();
        public static int DoanhThuNgay(DateTime ngay)
        {
            return Convert.ToInt32(cd.TongBan_Ngay(ngay)) - Convert.ToInt32(cd.TongNhap_Ngay(ngay)) - Convert.ToInt32(cd.TongPhatSinhNgay(ngay));
        }
        public static int Doanhthu_Khoangtg(DateTime bd, DateTime kt)
        {
            return Convert.ToInt32(cd.TongBan_Tg(bd, kt)) - Convert.ToInt32(cd.TongPhatSinh(bd, kt)) - Convert.ToInt32(cd.TongNhap(bd, kt));
        }
        public static int DoanhthuThang(DateTime thang)
        {
            return Convert.ToInt32(cd.Tongban_Thang(thang)) - Convert.ToInt32(cd.TongPhatSinhThang(thang)) - Convert.ToInt32(cd.TongNhap_Thang(thang));
        }
        public static int DoanhThuNam(DateTime nam)
        {
            return Convert.ToInt32(cd.Tongban_Nam(nam)) - Convert.ToInt32(cd.TongPhatSinhNam(nam)) - Convert.ToInt32(cd.TongNhap_Nam(nam));
        }
    }
}
